Skip to content

Conversation

@brendt
Copy link
Member

@brendt brendt commented Jul 25, 2025

Including the content of dynamic slots in the template using normal var_export can cause compiler errors because var_export doesn't properly escape quoted strings within exported values.

To work around that, I added a new \Tempest\View\Export\ViewObjectExporter that exports objects to valid PHP code.

For now, this exporter is very hard-coded towards this one specific use-case for exporting slots. We might refactor it in the future to be something reusable, and maybe even integrate it with the mapper (something like map($object)->toPhp(), but that's out of scope for now.)

@brendt brendt merged commit 4284e8b into main Jul 25, 2025
85 of 86 checks passed
@brendt brendt deleted the imoroved-slot-exporting branch July 25, 2025 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants